<?php
/**
 * Created by PhpStorm.
 * User: Tomkk
 * Date: 2016/5/10
 * Time: 19:58
 */

require "utils/result.php";
    if ($_FILES["file"]["error"] > 0)
    {
        echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
    else
    {
         $ext = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
         $newName = date("YmdHis") .'.'.$ext;
            move_uploaded_file($_FILES["file"]["tmp_name"],
                    "upload/" . $newName);
//        http://localhost/final/pro/img/.$newName
            die(success(0,"http://localhost/final/pro/backend/upload/".$newName));
    }
